using UnityEngine;

public class TutorialUI : MonoBehaviour
{
	public GameObject tutorial_gui;

	public bool show_only_once = true;

	public GameObject[] tutorial_boxes;

	private int counter;

	private void Start()
	{
		int @int = PlayerPrefs.GetInt("tutorial_" + PlayerPrefs.GetInt("selected_level", 0), 0);
		if (tutorial_boxes.Length > 0)
		{
			if (show_only_once && @int == 0)
			{
				tutorial_gui.SetActive(value: true);
				ShowBox();
				PlayerPrefs.SetInt("tutorial_" + PlayerPrefs.GetInt("selected_level", 0), 1);
			}
			else if (!show_only_once)
			{
				tutorial_gui.SetActive(value: true);
				ShowBox();
			}
			else
			{
				HideAll();
			}
		}
	}

	private void ShowBox()
	{
		Time.timeScale = 0.01f;
		int num = 0;
		GameObject[] array = tutorial_boxes;
		foreach (GameObject gameObject in array)
		{
			if (num == counter)
			{
				gameObject.SetActive(value: true);
			}
			else
			{
				gameObject.SetActive(value: false);
			}
			num++;
		}
	}

	private void HideAll()
	{
		Time.timeScale = 1f;
		tutorial_gui.SetActive(value: false);
	}

	public void OkClick()
	{
		if (counter < tutorial_boxes.Length - 1)
		{
			counter++;
			ShowBox();
		}
		else
		{
			counter = 0;
			HideAll();
		}
	}
}
